dojo.addOnLoad(function() {
	if(isReportNav&&(isReportNav=="true"||isReportNav==true)){
		refreshReportNav(parent.window,reportName);//创建更改导航条
	}
});

function openReportNav(url, target) {

	if (typeof target != "undefined" && target != "_self") {
		var form = document.createElement('form');
		form.style.display = 'none';
		form.method = 'POST';
		form.target = target;
		form.action = url;
		document.body.appendChild(form);
		form.submit();
		document.body.removeChild(form);
	} else {
		var reportdocument = document;
		var reportwindow = window;
		if (isReportNav && (isReportNav == "true" || isReportNav == true)) {
			reportdocument = parent.document;
			reportwindow = parent.window;
		}
		var i = 0;
		if (isReportNav && (isReportNav == "true" || isReportNav == true)) {
			i = reportwindow.report_nav_names.length;
			var iframeDisplay = reportdocument.getElementById("ReportFrame_"
					+ (i - 1));
			iframeDisplay.style.display = "none";
		} else {
			window.report_nav_names = [];
			var firstform = document.getElementById("resultForm");
			firstform.style.display = "none";
			var report_nav_div = document.getElementById("report_nav_div");// 添加统一div
			if (!report_nav_div) {
				report_nav_div = document.createElement('div');
				report_nav_div.setAttribute("id", "report_nav_div");
				report_nav_div.setAttribute("name", "report_nav_div");
				report_nav_div.setAttribute("style", "width:100%;height:100%;");
				document.body.appendChild(report_nav_div);
			}
		}
		var iframe = reportdocument.createElement('iframe');
		iframe.setAttribute("id", "ReportFrame_" + i);
		iframe.setAttribute("name", "ReportFrame_" + i);
		iframe.setAttribute("border", "0");
		iframe.setAttribute("frameborder", "0");
		iframe.setAttribute("width", "100%");
		iframe.setAttribute("height", "99%");

		// reportdocument.body.appendChild(iframe);
		reportdocument.getElementById("report_nav_div").appendChild(iframe);
		reportwindow.report_nav_names.push(reportName);

		var form = reportdocument.createElement('form');
		form.style.display = 'none';
		form.method = 'POST';
		form.target = "ReportFrame_" + i;
		form.action = url + "&isReportNav=true";

		reportdocument.body.appendChild(form);
		form.submit();
		reportdocument.body.removeChild(form);
	}
}

function refreshReportNav(reportwindow,reportName) {
	var navigation=document.getElementById("report_nav_id");
    if(navigation){
    	document.body.removeChild(navigation);
    }
    if(reportwindow.report_nav_names&&reportwindow.report_nav_names.length==0){
    	return;
    }
	var navigation = document.createElement('div');
	dojo.attr(navigation, 'id', 'report_nav_id');
//	dojo.attr(navigation,'style','position:absolute;');
	dojo.addClass(navigation, 'report_navigation');
	dojo.place(navigation, dojo.byId('resultForm'), 'first');
	
	if (typeof reportwindow.report_nav_names != "undefined"){
		var span = document.createElement('span');
		span.innerHTML = ' > ';
		dojo.place(span, navigation, 'last');
		for ( var i = 0; i < reportwindow.report_nav_names.length; i++) {
			span = document.createElement('span');
			if (reportwindow.report_nav_names[i].indexOf(';') > 0) {
				span.innerHTML = reportwindow.report_nav_names[i].substr(0, reportwindow.report_nav_names[i].indexOf(';'));
			} else {
				span.innerHTML = reportwindow.report_nav_names[i];
			}
			dojo.place(span, navigation, 'last');
			dojo.addClass(span, 'link');
			span.onclick = dojo.hitch(null, "gotoReportNav",reportwindow,i);
			span = document.createElement('span');
			span.innerHTML = ' > ';
			dojo.place(span, navigation, 'last');
		}
		span = document.createElement('span');
		if (reportName.indexOf(';') > 0) {
			span.innerHTML = reportName.substr(0, reportName.indexOf(';'));
		} else {
			span.innerHTML = reportName;
		}
		dojo.place(span, navigation, 'last');
	}
}

function gotoReportNav(reportwindow,levelNo){
	if(levelNo==0){
		var firstform=reportwindow.document.getElementById("resultForm");
		firstform.style.display="";
		var report_nav_div = reportwindow.document.getElementById("report_nav_div");
		if(report_nav_div){
			reportwindow.document.body.removeChild(report_nav_div);
		}
	}else{
		var iframeDisplay=reportwindow.document.getElementById("ReportFrame_"+(levelNo-1));
		iframeDisplay.style.display="";
		var name=reportwindow.report_nav_names[levelNo];
		for(var i=levelNo,j=reportwindow.report_nav_names.length;i<j;i++){
			reportwindow.report_nav_names.pop();
			var rIframe=reportwindow.document.getElementById("ReportFrame_"+i);
			if(rIframe){
				reportwindow.document.getElementById("report_nav_div").removeChild(rIframe);
			}
		}
	}
//	reportwindow.refreshReportNav(reportwindow,name);
}